package HTTPRecieveParser;

public class StartupInd {
	private String startUpIndMessage;

	public static final String MMS_MESSAGE_TYPE = "X-Mms-Message-Type:";
	public static final String MMS_FROM = "From:";

	private String mmsMessageType;
	private String mmsFrom;

	public String getMessageType() {
		return mmsMessageType;
	}

	public String getFrom() {
		return mmsFrom;
	}

	public StartupInd(String startUpIndMessage) {
		this.startUpIndMessage = startUpIndMessage;
	}

	public void decodeMessage() {

		try {
			String[] result = startUpIndMessage.split("\n");

			for (int i = 0; i < result.length; i++) {
				if (result[i].startsWith(MMS_MESSAGE_TYPE))
					mmsMessageType = (result[i].substring((result[i].indexOf(':')) + 2));

				else if (result[i].startsWith(MMS_FROM))
					mmsFrom = result[i].substring((result[i].indexOf(':')) + 2);
			}
		} catch (ArrayIndexOutOfBoundsException e) {
			System.out.println("Malformed response message");
		}
	}
}
